#!/bin/bash
#Generates a dump of all TC and IPT info related to Trafficcontrol.
#(C) 2008 DatuX HR Meertens

#TIP: The iptables rules and TC are related via the "handle" of an Egress filter 
#and the "mark" of iptables.....
#Ingress and Iptables having no relation with each other.

#Put here the devices to get info from.
DEVICES=(eth0 ifb0 wlan0)


TC=/sbin/tc
IPT=/sbin/iptables
#Iterate through the devices and fix per devices the info.
for i in "${DEVICES[@]}"
do

	echo "***********************************TC INFO $i*************************************"
	echo ""
	echo "***********************************Classes $i*************************************";
	$TC -s -d class ls dev $i; 
	echo ""
	echo "***********************************Qdiscs $i**************************************";
	$TC -s -d qdisc ls dev $i
	echo "";
	echo "***********************************Egress Filters $i******************************";
	$TC -s -d filter ls dev $i; 
	echo "";
	echo "***********************************Ingress Filters $i*****************************";
	$TC -s -d filter ls dev $i parent ffff:
	echo "";
done

echo "***********************************IPTABLES MANGLE INFO***************************"
$IPT -t mangle -L -n -v
echo "";
echo "";
